package com.api.gbhg.daiyanlu.action;


import com.api.gbhg.daiyanlu.DataPrintCopyUtil.CommonMethod;
import com.api.gbhg.liwenjun.GBHGConstant;
import com.api.gbhg.liwenjun.VersionFlowUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * 08复印纸、打印纸用量需求表
 * Mr.dyl
 */
public class PrintCopy implements Action {

    private static final Logger log= LoggerFactory.getLogger(PrintCopy.class);
    @Override
    public String execute(RequestInfo requestInfo) {
        Map<String,String> map=new HashMap<>();
        String flowTableName = VersionFlowUtil.getFlowTableName(requestInfo.getWorkflowid());
        map.put("xmmin","xmmc");
        map.put("yszje","zfcgyswy");
        boolean isSuccess = VersionFlowUtil.sysDataToVersion(requestInfo.getRequestid(),requestInfo.getWorkflowid(), GBHGConstant.FlowVersionTableEnum.uf_fyzdyzylxqbbb,map);
        boolean b = CommonMethod.updateTotalBudgetAmount(requestInfo.getRequestid(),requestInfo.getWorkflowid());//修改预算总金额
        if(!isSuccess && b){
            log.info("主表版本表同步失败");
            requestInfo.getRequestManager().setMessagecontent("版本主表同步失败");
            requestInfo.getRequestManager().setMessageid("1");
            return FAILURE_AND_CONTINUE;
        }
        return SUCCESS;
    }
}
